define(['app/utils/HttpClientUtils','libs/jweixin-1.0.0'], function (hc, wx) {

	window.wx = wx;

	var url = "/node4/weixin/wxsdk_config";
	var body = "{\"url\":\"" + window.location.href + "\"}";

	hc.sendPOST(url,body, function(resp){
		
		
		if(resp.status == "200"){
			var debug = false;//resp.data[0].debug;
			var appId = resp.result.appId;
			var timestamp = resp.result.timestamp;
			var nonceStr = resp.result.nonceStr;
			var signature = resp.result.signature;
			var jsApiList = resp.result.jsApiList;
			
			jsApiList = [
			    'onMenuShareTimeline',
			    'onMenuShareAppMessage',
			    'onMenuShareQQ',
			    'onMenuShareWeibo',
			    'onMenuShareQZone',
			    'startRecord',
			    'stopRecord',
			    'onVoiceRecordEnd',
			    'playVoice',
			    'pauseVoice',
			    'stopVoice',
			    'onVoicePlayEnd',
			    'uploadVoice',
			    'downloadVoice',
			    'chooseImage',
			    'previewImage',
			    'uploadImage',
			    'downloadImage',
			    'translateVoice',
			    'getNetworkType',
			    'openLocation',
			    'getLocation',
			    'hideOptionMenu',
			    'showOptionMenu',
			    'hideMenuItems',
			    'showMenuItems',
			    'hideAllNonBaseMenuItem',
			    'showAllNonBaseMenuItem',
			    'closeWindow',
			    'scanQRCode',
			    'chooseWXPay',
			    'openProductSpecificView',
			    'addCard',
			    'chooseCard',
			    'openCard' 
			];
			


			window.wx.config({
			    debug: debug, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
			    appId: appId, // 必填，公众号的唯一标识
			    timestamp:  timestamp, // 必填，生成签名的时间戳
			    nonceStr:  nonceStr, // 必填，生成签名的随机串
			    signature:  signature,// 必填，签名，见附录1
			    jsApiList:  jsApiList // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});
		
			
		}else{
			console.log("获取配置失败，请检查网络连接是否正确");	
		}
		
	},null, true);
	
	
	return wx;
});